<link rel="stylesheet" type="text/css" href="http://{$strona.domena}/P/dhtmlxGrid/codebase/dhtmlxgrid.css" />
<script src="http://{$strona.domena}/P/dhtmlxGrid/codebase/dhtmlxcommon.js"></script>
<script src="http://{$strona.domena}/P/dhtmlxGrid/codebase/dhtmlxgrid.js"></script>
<script src="http://{$strona.domena}/P/dhtmlxGrid/codebase/dhtmlxgridcell.js"></script>
<script src="http://{$strona.domena}/P/dhtmlxGrid/codebase/ext/dhtmlxgrid_filter.js"></script>
<script src="http://{$strona.domena}/P/dhtmlxToolbar/codebase/dhtmlxcommon.js"></script>
<script src="http://{$strona.domena}/P/dhtmlxToolbar/codebase/dhtmlxtoolbar.js"></script>
<link rel="stylesheet" type="text/css" href="http://{$strona.domena}/P/dhtmlxToolbar/codebase/skins/dhtmlxtoolbar_dhx_web.css" />

<div class="zawartosc">
    <div id="toolbarDiv"></div>
    <div id="mygrid_container" style="height:500px; width: 100%"></div>
</div>

<script type="text/javascript">
    /* Grid */
    var grid;
    grid = new dhtmlXGridObject('mygrid_container');
    grid.setImagePath("http://{$strona.domena}/P/dhtmlxGrid/codebase/imgs/");
    grid.setHeader("Id,Treść,Data od,Data do,Status");
    grid.setInitWidths("40,*,120,120,80");
    grid.setColAlign("left,center,center,center,center");
    grid.setSkin("light");
    grid.setColSorting("int,str,date,date,str");
    grid.init();
    grid.loadXML('/cms/rotator/akcja,xml.html');
    /* Toolbar */
    var toolbar = new dhtmlXToolbarObject('toolbarDiv','dhx_web');
    toolbar.setIconsPath("http://{$strona.domena}/P/dhtmlxToolbar/ikonki/");
    toolbar.addButton(1, 1, "Dodaj baner",'new.gif','new_dis.gif');
    toolbar.addButton(2, 2, "Edytuj baner",'cut.gif','cut_dis.gif');
    toolbar.addButton(3, 3, "Usuń baner",'debug.gif','debug_dis.gif');
    toolbar.disableItem(2);
    toolbar.disableItem(3);
    toolbar.attachEvent("onClick", function(id){
        switch(id)
        {
            case '1':
                window.location = '/cms/rotator/edycja/akcja,dodaj.html';
                break;
            case '2':
                window.location = '/cms/rotator/edycja/akcja,edytuj,id,'+grid.getSelectedId()+'.html';
                break;
            case '3':
                dhtmlxAjax.getSync('/cms/rotator/edycja/akcja,usun,id,'+grid.getSelectedId()+'.html');
                grid.updateFromXML('/cms/rotator/akcja,xml.html', true, true, false);
                break;
            default:
                alert('Wybrałeś nieobsługiwaną opcję!');
        }
    });
    grid.attachEvent("onRowSelect", function(id,ind){
        toolbar.enableItem(2);
        toolbar.enableItem(3);
    });
</script>
